/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tbltiponomina")
@NamedQueries({
    @NamedQuery(name = "Tbltiponomina.findAll", query = "SELECT t FROM Tbltiponomina t"),
    @NamedQuery(name = "Tbltiponomina.findByCodigo", query = "SELECT t FROM Tbltiponomina t WHERE t.codigo = :codigo"),
    @NamedQuery(name = "Tbltiponomina.findByNombre", query = "SELECT t FROM Tbltiponomina t WHERE t.nombre = :nombre"),
    @NamedQuery(name = "Tbltiponomina.findByPeriodo", query = "SELECT t FROM Tbltiponomina t WHERE t.periodo = :periodo")})
public class Tbltiponomina implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "codigo")
    private String codigo;
    @Size(max = 40)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 2)
    @Column(name = "periodo")
    private String periodo;
    @JoinColumn(name = "cod_com", referencedColumnName = "cod_compania")
    @ManyToOne(optional = false)
    private Tblcompania codCom;

    public Tbltiponomina() {
    }

    public Tbltiponomina(String codigo) {
        this.codigo = codigo;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getPeriodo() {
        return periodo;
    }

    public void setPeriodo(String periodo) {
        this.periodo = periodo;
    }

    public Tblcompania getCodCom() {
        return codCom;
    }

    public void setCodCom(Tblcompania codCom) {
        this.codCom = codCom;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tbltiponomina)) {
            return false;
        }
        Tbltiponomina other = (Tbltiponomina) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + nombre + "";
    }
    
}
